<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title>上传文件</title>
    </head>
    <body>
        <form action="/upload" method="post" enctype="multipart/form-data">
            <label>
                上传文件：
                <input type="file" name="file" id="file">
            </label>
            <button type="submit">上传文件</button>
        </form>
        <img id="img" src="" alt="">
        <script>
            file.onchange = function(e) {
                img.src = window.URL.createObjectURL(e.target.files[0]);
            }
        </script>
    </body>
</html>